import { useEffect, useState } from 'react'
import { fetchChannelAPI } from '@/api/list'
import type { ChannelItem } from '@/api/list'

export const useTab = () => {

    const [channelsList, setChannelsList] = useState<ChannelItem[]>([])
    
    useEffect(() => {
        const getChannelsList = async () => {
            const res = await fetchChannelAPI()
            setChannelsList(res.data.data.channels)
        }
        getChannelsList()
    }, [])

    return {
        channelsList
    }
}
